<template>
  <div class="article">
    <!-- 文本精选卡片 -->
    <template v-if="cardType == 1">
      <div v-for="item in 2" :key="item" class="card-wrap padding-16">
        <ul class="user-info">
          <li class="user-info-img">
            <img src="https://default.test.file.mediportal.com.cn/user/default_man.jpg" alt="" />
          </li>
          <li class="user-info-tips">
            <p class="tips-title">有趣的书籍</p>
            <p class="tips-msg">好位置留给说书人 启发火炉旁的人</p>
          </li>
        </ul>
        <div class="article-wrap">
          <ul class="article-list">
            <li class="article-list-title">最新前端坑位 | 前端早早聊大会</li>
            <li class="article-list-time">01-17 12:55</li>
          </ul>
          <ul class="article-list">
            <li class="article-list-title">初尘：财富自由之路</li>
            <li class="article-list-time">01-15 10:20</li>
          </ul>
          <ul class="article-list">
            <li class="article-list-title">初尘：财富自由之路</li>
            <li class="article-list-time">01-15 10:20</li>
          </ul>
        </div>
      </div>
    </template>
    <!-- 文章列表卡片 -->
    <template v-if="cardType == 2">
      <div v-for="(item, idx) in 40" :key="item" class="card-wrap">
        <!-- cover卡片 -->
        <template v-if="idx % 2 == 0">
          <div class="card-cover">
            <img src="https://vpan.test.file.mediportal.com.cn/FtmX4cN-3AWth9A2A-Mq1JXuLPzh" alt="" />
          </div>
          <ul class="user-info padding-16">
            <li class="user-info-img">
              <img src="https://default.test.file.mediportal.com.cn/user/default_man.jpg" alt="" />
            </li>
            <li class="user-info-tips">
              <p class="tips-title">有趣的书籍</p>
              <p class="tips-msg">好位置留给说书人 启发火炉旁的人</p>
            </li>
          </ul>
        </template>
        <!-- 照片墙卡片 -->
        <template v-if="idx % 2 != 0">
          <ul class="user-info padding-16">
            <li class="user-info-img">
              <img src="https://default.test.file.mediportal.com.cn/user/default_man.jpg" alt="" />
            </li>
            <li class="user-info-tips">
              <p class="tips-title">有趣的书籍</p>
              <p class="tips-msg">好位置留给说书人 启发火炉旁的人</p>
            </li>
          </ul>
          <ul class="article-img padding-16">
            <li><img class="article-img-li" src="https://vpan.test.file.mediportal.com.cn/FtmX4cN-3AWth9A2A-Mq1JXuLPzh" alt="" /></li>
            <li><img class="article-img-li" src="https://vpan.test.file.mediportal.com.cn/FtmX4cN-3AWth9A2A-Mq1JXuLPzh" alt="" /></li>
            <li><img class="article-img-li" src="https://vpan.test.file.mediportal.com.cn/FtmX4cN-3AWth9A2A-Mq1JXuLPzh" alt="" /></li>
          </ul>
        </template>
      </div>
    </template>
    <!-- 用户列表卡片 -->
    <template v-if="cardType == 3">
      <div class="member-wrap padding-16">
        <ul class="member-flex">
          <li v-for="item in 6" :key="item">
            <img class="member-img" src="https://default.test.file.mediportal.com.cn/user/default_man.jpg" alt="" />
            <p class="member-hot">
              <img class="member-hot-img" src="./imgs/hot.png" alt="" />
              22
            </p>
            <p class="member-name">EVA WU</p>
          </li>
        </ul>
      </div>
    </template>
  </div>
</template>

<script>
export default {
  props: {
    cardType: {
      type: [String, Number],
      default: '1',
    },
  },
}
</script>

<style lang="scss" scoped>
.article {
  display: flex;
  flex-flow: row wrap;
  .padding-16 {
    padding: 16px;
  }
  .card-wrap {
    width: 330px;
    margin: 12px 0 0 8px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    .card-cover {
      width: 328px;
      height: 164px;
      border-radius: 4px 4px 0 0;
      border: solid #e8e8e8;
      border-width: 1px 1px 0;
      img {
        width: 100%;
        height: 100%;
        object-fit: cover;
      }
    }
    .user-info {
      display: flex;
      .user-info-img {
        flex: 0 0 34px;
        img {
          width: 24px;
          height: 24px;
          border-radius: 50%;
        }
      }
      .user-info-tips {
        flex: 1;
        .tips-title {
          color: #262626;
          font-weight: 500;
          font-size: 16px;
        }
        .tips-msg {
          font-size: 12px;
          color: #8c8c8c;
          margin-top: 8px;
        }
      }
    }
    .article-wrap {
      display: flex;
      flex-flow: column nowrap;
      justify-content: space-between;
      height: 118px;
      padding-top: 10px;
      margin-top: 8px;
      border-top: 1px solid #e8e8e8;
      .article-list {
        display: flex;
        .article-list-title {
          flex: 1;
          font-size: 14px;
          color: #c8c8c8;
        }
        .article-list-time {
          flex: 0 0 80px;
          font-size: 12px;
          color: #bfbfbf;
        }
      }
    }
    .article-img {
      display: flex;
      flex-flow: row nowrap;
      justify-content: space-between;
      padding-top: 20px;
      border-top: 1px solid #e8e8e8;
      li {
        flex: 0 0 30%;
        .article-img-li {
          width: 96px;
          height: 96px;
          object-fit: cover;
          border-radius: 2px;
        }
      }
    }
  }
  .member-wrap {
    width: 100%;
    height: 144px;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
    color: #a7a7a7;
    .member-flex {
      display: flex;
      flex-flow: row nowrap;
      justify-content: space-between;
      li {
        flex: 1;
        text-align: center;
        .member-img {
          width: 56px;
          height: 56px;
          border-radius: 50%;
        }
        .member-hot {
          display: inline-block;
          position: relative;
          top: -6px;
          height: 23px;
          width: 56px;
          font-size: 12px;
          font-weight: 700;
          text-align: center;
          border-radius: 12px;
          background-color: #f5f5f5;
          border: 1px solid #f5f5f5;
          &-img {
            width: 12px;
            height: 12px;
            margin-bottom: 2px;
          }
        }
        .member-name {
          margin-top: 8px;
          font-size: 14px;
          color: #595959;
        }
      }
    }
  }
}
</style>
